package com.bilibili.servlet;
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bilibili.entity.CommenResult;
import com.bilibili.service.DanmakuService;
import com.bilibili.service.impl.DanmakuServiceImpl;

@WebServlet("/countBlockedDanmaku.do")
public class CountBlockedDanmakuServlet extends HttpServlet {
    private DanmakuService danmakuService = new DanmakuServiceImpl();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("application/json;charset=utf-8");
        int upId = Integer.parseInt(request.getParameter("upId"));
        int count = danmakuService.getBlockedDanmakuCount(upId);
        CommenResult result = new CommenResult();
        result.setCode(200);
        result.setMessage("查询成功");
        result.setData(count);
        response.getWriter().write(result.toJOSNString());
    }
}